package com.cysoft.service;

import com.cysoft.dao.TaskDao;
import com.cysoft.dao.WheelDao;
import com.cysoft.domain.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author andaolong
 * @time 2021/3/27-15:18
 * @describe
 */
@Service
public class TaskService {

    @Autowired
    private TaskDao bomTaskDao;
    @Autowired
    private MoldService moldService;

    //获取到bomTask，并填入对应的process
    public List<Task> getBomTaskList() {

        List<Task> taskList = bomTaskDao.getBomTaskListFromDB();

        for (Task task : taskList){
            // 分配模具
            task.setMold(moldService.assignMold(task.getWheelCode(),task.getBeginDateTime(),task.getEndDateTime()));
        }
        return taskList;

    }

}

